const path = require('path');

const resolve = dir => {
  return path.join(__dirname, dir)
}

const { name } = require('./package');
module.exports = {
  chainWebpack: config => {
    config.resolve.alias
    .set('@', resolve('src'))
  },
  devServer: {
    port: 8081,
    headers: { // 解决跨域问题
      'Access-Control-Allow-Origin': '*',
    },
  },
  configureWebpack: {
    output: {
      library: `${name}-[name]`,
      libraryTarget: 'umd', // 把微应用打包成 umd 库格式
      jsonpFunction: `webpackJsonp_${name}`,
    },
  },
};